package JDKtest.java_lang_test.String;

public class StringToInt {
    public static int stringToInt(String s) throws NumberFormatException {
        return Integer.parseInt(s);
    }

    public static void main(String[] args) {
        String str = "12345";
        try {
            int num = stringToInt(str);
            System.out.println("转换后的整数是: " + num);
        } catch (NumberFormatException e) {
            System.out.println("输入的字符串无法转换为整数: " + str);
        }
    }
}